@page "/Admin/Roles"
@rendermode InteractiveServer
@attribute [Authorize(Roles = "Administrator")]
@attribute [UserNavigation("权限设置")]
@attribute [TabItemOption(Text = "权限设置", Icon = "fa-solid fas fa-user-secret")]
 
<Table TItem="Role" ExtendButtonColumnWidth="325"
  OnQueryAsync="OnQueryAsync"
         ShowToolbar="true"
            IsBordered="true" 
            IsStriped="true" 
            IsMultipleSelect="true" 
    
            OnDeleteAsync="RoleService.DeleteAsync">
    <TableToolbarTemplate>
        <TableToolbarButton TItem="Role" IsEnableWhenSelectedOneRow="true" Color="Color.Info" Icon="fa-solid fa-user" Text="用户" OnClickCallback="roles => OnAssignmentUsers(roles.First())" /> 
        <TableToolbarButton TItem="Role" IsEnableWhenSelectedOneRow="true" Color="Color.Success" Icon="fa-solid fa-bars" Text="菜单" OnClickCallback="roles => OnAssignmentMenus(roles.First())" />
    </TableToolbarTemplate>
    <TableColumns>
        <TableColumn @bind-Field="@context.Name" Sortable="true" Filterable="true" Searchable="true" Width="120"></TableColumn>

    </TableColumns>
    <RowButtonTemplate>
   
        <TableCellButton Size="Size.ExtraSmall" Color="Color.Success" Icon="fa-solid fa-bars" Text="菜单" OnClick="() => OnAssignmentMenus(context)" />
    </RowButtonTemplate>
</Table>

 